<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <input type="text" v-model="num1">
  <input type="text" v-model="num2">
  <input type="button" value="加" @click="f('+')">
  <input type="button" value="减" @click="f('-')">
  <input type="button" value="乘" @click="f('*')">
  <input type="button" value="除" @click="f('/')"><br>
  结果: <span>{{result}}</span>
</div>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.min.js"></script>

<script>

  let v = new Vue({
    el:"div",
    data:{
      result:"",
      num1:"",
      num2:""
    },
    methods:{
      f:function (x){
        v.result = eval(v.num1+x+v.num2)

        // switch (x){
        //   case '+':
        //     v.result = v.num1*1+v.num2*1;
        //     break;
        //   case '-':
        //     v.result = v.num1-v.num2;
        //     break;
        //   case '*':
        //     v.result = v.num1*v.num2;
        //     break;
        //   case '/':
        //     v.result = v.num1/v.num2;
        //     break;
        // }

      }
    }
  })
</script>
</body>
</html>